package sample.activemq;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;

import javax.jms.Queue;

/**
 * @author wangzhilong
 * @date 2019-06-10
 */
@Component
public class Producer implements CommandLineRunner {


    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;

    @Autowired
    private Queue queue;

    public void run(String... args) throws Exception {
        jmsMessagingTemplate.convertAndSend(queue, "hello wolrd");
    }
}
